<template>
	<view class="loading" v-show="showLoading">
		<view class="loading-box">
			<view>
				<view class="loading-square">
					<view class="loading-item loadingSevenViewFirst"></view>
					<view class="loading-item loadingSevenViewSecond"></view>
					<view class="loading-item loadingSevenViewThird"></view>
					<view class="loading-item loadingSevenViewForth"></view>
				</view>
			</view>
			<view class="text-tip">正在刷新</view>
		</view>
	</view>
</template>
<script setup>
	import {
		ref,
		computed
	} from "vue";
	import {
		useStore
	} from "vuex";
	const store = useStore();
	const showLoading = computed(() => store.state.showLoading)
</script>

<style lang="scss" scoped>
	.loading {
		z-index: 20000;
		width: 100%;
		height: 100vh;
		position: fixed;
		// display: flex;
		// align-items: center;
	}

	.loading-box {
		position: absolute;
		width: 100%;
		top: calc(50% - 160rpx);
		background-repeat: no-repeat;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background-size: 100% 300rpx;


	}


	.loading-square {
		display: flex;
		align-items: center;
		height: 56rpx;

		.loading-item {
			width: 8rpx;
			margin-right: 8rpx;
			height: 100%;
			background: linear-gradient(180deg, #3370ED 0%, #25C9FF 100%);
			animation: loading 1.04s ease infinite;
			-webkit-animation: loading 1.04s ease infinite;

			&:nth-child(1) {
				-webkit-animation-delay: -0.52s;
			}

			&:nth-child(2) {
				-webkit-animation-delay: -0.13s;
			}

			&:nth-child(3) {
				-webkit-animation-delay: -0.26s;
			}

			&:nth-child(4) {
				-webkit-animation-delay: -0.39s;
			}

			&:nth-child(5) {
				-webkit-animation-delay: -0.52s;
			}
		}
	}


	@keyframes loading {
		100% {
			height: 56rpx;
		}

		85% {
			height: 35rpx;
		}

		70% {
			height: 14rpx;
		}

		50% {
			height: 7rpx;
		}

		30% {
			height: 14rpx;
		}

		15% {
			height: 35rpx;
		}

		0% {
			height: 56rpx;

		}
	}

	.text-tip {
		color: #3370ED;
		font-size: 24rpx;
		line-height: 24rpx;
		margin-top: 20rpx;
	}
</style>